package com.sunny.wordstudy;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.preference.PreferenceManager;
import weibo4andriod.a.a;
import weibo4andriod.a.h;
import weibo4andriod.c;
import weibo4andriod.e;
import weibo4andriod.g;

public final class bn
{
  private Activity a;
  private boolean b;

  public bn(Activity paramActivity)
  {
    this.a = paramActivity;
    System.setProperty("weibo4j.oauth.consumerKey", e.a);
    System.setProperty("weibo4j.oauth.consumerSecret", e.b);
    this.b = a();
  }

  public final void a(String paramString)
  {
    SharedPreferences.Editor localEditor = PreferenceManager.getDefaultSharedPreferences(this.a).edit();
    localEditor.putString("weibo_toupdatestatus", paramString);
    localEditor.commit();
  }

  public final void a(String paramString1, String paramString2, int paramInt, String paramString3)
  {
    SharedPreferences.Editor localEditor = PreferenceManager.getDefaultSharedPreferences(this.a).edit();
    localEditor.putString("weibo_token", paramString1);
    localEditor.putString("weibo_tokensecret", paramString2);
    localEditor.putInt("weibo_uid", paramInt);
    localEditor.putString("weibo_uname", paramString3);
    localEditor.commit();
    this.b = true;
  }

  public final boolean a()
  {
    SharedPreferences localSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.a);
    String str1 = localSharedPreferences.getString("weibo_token", "");
    String str2 = localSharedPreferences.getString("weibo_tokensecret", "");
    int i = localSharedPreferences.getInt("weibo_uid", 0);
    String str3 = localSharedPreferences.getString("weibo_uname", "");
    if ((str1 != null) && (str2 != null) && (str1.length() > 0) && (str2.length() > 0))
    {
      StringBuilder localStringBuilder = new StringBuilder();
      localStringBuilder.append("oauth_token_secret=").append(str2);
      localStringBuilder.append("&oauth_token=").append(str1);
      localStringBuilder.append("&user_id=").append(i);
      localStringBuilder.append("&screen_name=").append(str3);
      a locala = new a(localStringBuilder.toString());
      ag.a().a(locala);
    }
    for (int j = 1; ; j = 0)
      return j;
  }

  public final String b()
  {
    SharedPreferences localSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this.a);
    String str1 = localSharedPreferences.getString("weibo_toupdatestatus", "");
    SharedPreferences.Editor localEditor = localSharedPreferences.edit();
    localEditor.putString("weibo_toupdatestatus", "");
    localEditor.commit();
    if (str1 == null);
    for (String str2 = ""; ; str2 = str1)
      return str2;
  }

  public final void b(String paramString)
  {
    SharedPreferences.Editor localEditor = PreferenceManager.getDefaultSharedPreferences(this.a).edit();
    localEditor.putString("weibo_endsessionautoupdate", paramString);
    localEditor.commit();
  }

  public final int c()
  {
    String str = PreferenceManager.getDefaultSharedPreferences(this.a).getString("weibo_endsessionautoupdate", "1");
    int i;
    try
    {
      int j = Integer.parseInt(str);
      i = j;
      return i;
    }
    catch (Exception localException)
    {
      i = 0;
    }
  }

  public final c c(String paramString)
  {
    e locale;
    if (this.b)
    {
      ag.a();
      locale = ag.b();
      locale.a(ag.a().d(), ag.a().e());
    }
    for (c localc = locale.b(paramString); ; localc = null)
    {
      return localc;
      a(paramString);
      d();
    }
  }

  public final void d()
  {
    System.setProperty("weibo4j.oauth.consumerKey", e.a);
    System.setProperty("weibo4j.oauth.consumerSecret", e.b);
    ag.a();
    e locale = ag.b();
    try
    {
      h localh = locale.a("weibo4andriod://OAuthActivity");
      Uri localUri = Uri.parse(localh.a() + "&from=xweibo");
      ag.a().a(localh);
      this.a.startActivity(new Intent("android.intent.action.VIEW", localUri));
      return;
    }
    catch (g localg)
    {
      localg.printStackTrace();
    }
  }
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     com.sunny.wordstudy.bn
 * JD-Core Version:    0.5.3
 */